Skip to content

x86/tdx: Release private memory before private->shared conversion - #160

Merged
Hardik Garg (hargar19) merged 1 commit into
microsoft:product/hcl-main/6.18from
dcui:decui/product/hcl-main/6.18
Aug 20, 2026
Merged

x86/tdx: Release private memory before private->shared conversion#160
Hardik Garg (hargar19) merged 1 commit into
microsoft:product/hcl-main/6.18from
dcui:decui/product/hcl-main/6.18

Conversation

@dcui

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR backports/rebases upstream Intel TDX guest changes to release accepted private pages back to the TDX “PENDING” state before performing private→shared GPA conversion, aiming to reduce failures when converting pages back to private on buggy VMMs.

Changes:

  • Add new TDCALL leaf ID and TDCS config flag bit for PAGE.RELEASE support.
  • Detect PAGE.RELEASE support at TDX guest setup time.
  • Implement TDG.MEM.PAGE.RELEASE flow and invoke it before private→shared conversion in tdx_enc_status_changed_phys().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
arch/x86/include/asm/shared/tdx.h Adds constants for TDG.MEM.PAGE.RELEASE leaf ID and TDCS PAGE_RELEASE config bit.
arch/x86/coco/tdx/tdx.c Detects PAGE.RELEASE support, implements page release helper, and uses it before private→shared conversion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread arch/x86/coco/tdx/tdx.c
Comment thread arch/x86/coco/tdx/tdx.c
Comment thread arch/x86/coco/tdx/tdx.c Outdated
Copilot AI review requested due to automatic review settings August 20, 2026 22:57
@dcui
Dexuan Cui (dcui) force-pushed the decui/product/hcl-main/6.18 branch from 7e96578 to 66e794f Compare August 20, 2026 22:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

arch/x86/coco/tdx/tdx.c:351

  • tdx_page_release_supported is initialized once during early boot and then treated as a read-only feature flag. Marking it __ro_after_init matches the hardening pattern used for similar CC globals (e.g., cc_vendor/cc_mask in arch/x86/coco/core.c) and prevents accidental/runtime modification.
static bool tdx_page_release_supported;

arch/x86/coco/tdx/tdx.c:410

  • The _tdx_release_memory() definition exceeds the kernel's typical 80-column style and is inconsistent with nearby wrapped function signatures (e.g., tdx_enc_status_changed_phys()). Please wrap the parameters to keep the declaration readable and checkpatch-friendly.
static bool _tdx_release_memory(phys_addr_t start, phys_addr_t end, phys_addr_t *cur)
{

Copilot AI review requested due to automatic review settings August 20, 2026 23:17
@dcui
Dexuan Cui (dcui) force-pushed the decui/product/hcl-main/6.18 branch from 66e794f to 4b85081 Compare August 20, 2026 23:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@chris-oo Chris Oo (chris-oo) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me. I assume we will drop these commits once we take a new kernel release and upstream has merged them? Have they merged in upstream?

@dcui

Copy link
Copy Markdown
Contributor Author

This looks reasonable to me. I assume we will drop these commits once we take a new kernel release and upstream has merged them? Have they merged in upstream?

Intel hasn't upstreamed the change yet. I suppose Intel will upstream the change some day, but there is no ETA yet. Once Intel upstreams the change, we will drop the commit once we take a new kernel version that has this change from Intel.

@dcui

Copy link
Copy Markdown
Contributor Author

BTW, the patch has been used by the host team for quite a while and they haven't seen any issues.

@hargar19
Hardik Garg (hargar19) merged commit dd0ee2f into microsoft:product/hcl-main/6.18 Aug 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants